package jdbc.way1;


import jdbc.connection.Connection;
import jdbc.connection.DB2Connection;
import jdbc.connection.MysqlConnection;

import java.util.Properties;

public class ConnectionFactory {

    public static Connection getConnection(String type, Properties prop) {
        if ("mysql".equals(type)) {
            return new MysqlConnection(prop);
        } else if ("db2".equals(type)) {
            return new DB2Connection(prop);
        } else {
            return () -> null;
        }
    }
}
